package com.chaofan.kings_poster.web;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Collections;

/**
 * Created by Chaofan at 2018-12-14 15:57
 * email:chaofan2685@qq.com
 **/
@Controller
public class IndexController {

    @RequestMapping("/")
    public String index(Model model){
        Collections.sort(DownloadController.RANKING_LISTS);
        if (DownloadController.RANKING_LISTS.size() >= 10){
            model.addAttribute("slideshows",DownloadController.RANKING_LISTS.subList(0,10));
        }else {
            model.addAttribute("slideshows",DownloadController.RANKING_LISTS);
        }
        return "index";
    }

}
